<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Decrypt Data</title>
</head>
<body>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" 
	import="java.util.*,self.crypt.db.*"    
%>
    <%
    	String operationToPerform = request.getParameter("operationName");
    	if(operationToPerform==null){ 
    		List saveEncryptedData=(List)request.getAttribute("dataToDisplay");%>
    		<table>
    		<form name="selectToDecrypt" method="post" action="/util/decrypt">
    			<input type="hidden" name="operationName" value="decryptData"/>
    			<tr><td>Key for decryption:</td> <td><input name="passPhrase" type="text" value=""/></td></tr>
    			<tr><td>Data to decrypt: <select name="idToDecrypt">
		    		<%
		    		for(int i=0;i<saveEncryptedData.size();i++){
		    			SaveEncryptedData sed=(SaveEncryptedData)saveEncryptedData.get(i);%>
		    			<option value="<%=sed.getId()%>"><%=sed.getUniqueId()%>-<%=sed.getCreateDate()%></option>
		    		<%}//for loop closed here%> 
		    		</select></td></tr>
		    		<tr><td><input type="submit" value="Decrypt"/></td></tr>
    		</form>
    		</table>
    	<% } //if condition closed.
    	else{
    	    String decryptedData=(String)request.getAttribute("decryptedData");
    	    %>
    	    	<%=decryptedData%>
    	    <%
    	}
    %>
</body>
</html>